<?php
namespace Acme\FilesManagerBundle\FM\Classes;
class File{
private $name;
public $path;
private $size;
private $modifyDate;
private $download="33";
private $isexists=false;
	public function __construct($file)
	{
		if(file_exists($file)){
				if(round(filesize($file)/1024/1024)!=0)
					$this->size=round(filesize($file)/1024/1024)." MB";
				else if(round(filesize($file)/1024)!=0)
					$this->size=round(filesize($file)/1024)." KB";
				else 
					$this->size=filesize($file)." B";
				$this->modifyDate=date("d/m/Y",filemtime($file));
				$this->path=dirname($file)."/";
				$this->name=substr($file,strlen($this->path));
				$this->isexists=true;
		}
	}
	public function isExists()
	{
		return $this->isexists;
	}
	public function getName()
	{return $this->name;}
	public function getSize()
	{return $this->size;}
	public function getModifyDate()
	{return $this->modifyDate;}
	public function delete()
	{
		unlink($this->path.$this->name);
	}
	public function rename($name)
	{
		rename($this->path.$this->name,$this->path.$name);
		$this->name=$name;
	}
	public function getDownloadCount()
	{return $this->download;}
	
}
?>